//========encoding:utf-8=========
/*
 * @describe:  三目运算符
 * @author:mhao
 * @copyright:chinasoft.cn
 * @date:2020年3月25日   下午8:12:12
 */
package edu.chinasoft.domain;

import java.util.List;

public class PageUnitForFunction {
	private List<Function> functionList;
	private int pageUnit;
	private int pageNum;
	private int recordNum;
	private int currentPage;

	public PageUnitForFunction() {
	}

	public List<Function> getFunctionList() {
		return functionList;
	}

	public void setFunctionList(List<Function> functionList) {
		this.functionList = functionList;
	}

	public int getPageUnit() {
		return pageUnit;
	}

	public void setPageUnit(int pageUnit) {
		this.pageUnit = pageUnit;
	}

	public int getPageNum() {
		int result = (recordNum-1)/pageUnit+1;
		return result;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getRecordNum() {
		return recordNum;
	}

	public void setRecordNum(int recordNum) {
		this.recordNum = recordNum;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getPrePage() {
		int result=this.currentPage-1;
		result=result<1?1:result;
		return result;
	}
	public int getNextPage() {
		int result=this.currentPage+1;
		result=result>this.getPageNum()?this.getPageNum():result;
		return result;
	}

	@Override
	public String toString() {
		return "PageUnitForFunction [functionList=" + functionList + ", pageUnit=" + pageUnit + ", pageNum=" + pageNum
				+ ", recordNum=" + recordNum + ", currentPage=" + currentPage + "]";
	}

}
